import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/index'

import mf from "@/components/modFilter"
Vue.component('mf', mf) 

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
Vue.use(MintUI)

import echarts from 'echarts'
Vue.prototype.$echarts = echarts 

import requests from './https'
Vue.prototype.requests = requests

import _ from 'lodash'
Vue.prototype._ = _


Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

// import nn from "@/components/message/message.js"
import { Message } from 'element-ui';
router.beforeEach((to, from, next) => {
  if (to.path === '/login') {
    next();
  } else {
    let token = localStorage.getItem('Authorization');

    if (token === null || token === '') {
      Message.warning('请登录')
      next('/login');
    } else {
      next();
    }
  }
});